/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef OLA_DEVICE_MODEL_H
#define OLA_DEVICE_MODEL_H

#include "ola_sdk_api.h"

#ifdef __cplusplus
extern "C" {
#endif

#define OLA_DEV_MODEL_MAX_SN_LEN        40
/* softap要求sn至少为3字节 */
#define OLA_DEV_MODEL_MIN_SN_LEN        3
#define OLA_DEV_MODEL_MAX_MODEL_LEN     32
#define OLA_DEV_MODEL_CATID_LEN         4
#define OLA_DEV_MODEL_VENDORID_LEN      4
#define OLA_DEV_MODEL_MAX_NAME_LEN      256
#define OLA_DEV_MODEL_PRODID_LEN        4
#define OLA_DEV_MODEL_MAX_VERSION_LEN   32
#define OLA_DEV_MODEL_MAX_MAC_LEN       16
#define OLA_DEV_MODEL_MAX_FWV_LEN       64
#define OLA_DEV_MODEL_MAX_HWV_LEN       64
#define OLA_DEV_MODEL_MAX_SWV_LEN       64
#define OLA_DEV_MODEL_MAX_UDID_LEN      64 /* 协议里定义udid为String 128，根据生成规则应该为String 64 */
#define OLA_DEV_MODEL_MANU_NAME_LEN     4
#define OLA_DEV_MODEL_PLATFORM_ID_LEN   2

typedef struct {
    char sn[OLA_DEV_MODEL_MAX_SN_LEN + 1];
    char udid[OLA_DEV_MODEL_MAX_UDID_LEN + 1];
    char model[OLA_DEV_MODEL_MAX_MODEL_LEN + 1];        /* 应用终端型号，同一个厂商下的不同型号设备此值必须不同 */
    char catID[OLA_DEV_MODEL_CATID_LEN + 1];        /* 设备类型ID，取值范围"000"~"FFF" */
    char vendorID[OLA_DEV_MODEL_VENDORID_LEN + 1];  /* 制造商ID，取值范围"000"~"FFF" */
    char devName[OLA_DEV_MODEL_MAX_NAME_LEN + 1];       /* 设备名称 */
    char prodId[OLA_DEV_MODEL_PRODID_LEN + 1];
    char version[OLA_DEV_MODEL_MAX_VERSION_LEN + 1];    /* 协议版本，当前为1.0 */
    char mac[OLA_DEV_MODEL_MAX_MAC_LEN + 1];            /* 设备mac地址，形式为a1b2c3d4e5f6 */
    char fwv[OLA_DEV_MODEL_MAX_FWV_LEN + 1];            /* firmware version 固件版本 */
    char hwv[OLA_DEV_MODEL_MAX_HWV_LEN + 1];            /* hardware version 硬件版本 */
    char swv[OLA_DEV_MODEL_MAX_SWV_LEN + 1];            /* software version 软件版本 */
    char manuName[OLA_DEV_MODEL_MANU_NAME_LEN + 1];
    char platformId[OLA_DEV_MODEL_PLATFORM_ID_LEN + 1];
    OlaProtocolType protType;                           /* 协议类型 */
} OlaDeviceInfo;

const OlaDeviceInfo *OlaGetDevInfo(void);

int OlaDevInfoInit(const OlaDevParam *devParam);

#ifdef __cplusplus
}
#endif

#endif /* OLA_DEVICE_MODEL_H */

